var express = require('express'),
    swig = require('swig-templates'),
    request = require('request'),
    router = express.Router(),
    common = require('../base/common.js');
router.get('/my-product-:type?',function(req, res,next) {
    var u_id = req.cookies.u_id ? req.cookies.u_id : '';
    request.post({
        url: config.resourcePath.apiRoot + "/index.php?m=PersonalCenter&a=getUserEquipmentsList",
        formData: {
            u_id: u_id
        }
    }, function (Serror, Sresponse, Sbody) {
        try {
            var EquipmentsList = JSON.parse(Sbody);
            var thatData={
                type:req.params.type,
                list:EquipmentsList
            };
            for(var item in thatData.list.data.equipments){
                var els=thatData.list.data.equipments[item];
                els.buy_address=JSON.parse(els.buy_address);
            }
            console.log('EquipmentsList');
            console.log(EquipmentsList.data.equipments);
            res.render('my-haier/my_product/my_product',thatData);
        } catch (e) {
        }
    });
});
module.exports = router;
